package vn.com.servicedirectory.controller;

import java.util.Map;

import javax.servlet.http.HttpServletRequest;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import vn.com.servicedirectory.common.CommonVariable;
import vn.com.servicedirectory.forms.GeographyDetailsForm;
import vn.com.servicedirectory.forms.GeographyIndexForm;

@Controller
public class GeographyController {
	
	public GeographyController() {
	}
	@RequestMapping(value = CommonVariable.PAGE_GEOGRAPHY_INDEX_HTML, method = RequestMethod.GET)
	public String showIndex(Model model,HttpServletRequest request) {
		GeographyIndexForm geographyIndexForm =new GeographyIndexForm();
		geographyIndexForm.setFormTitle(CommonVariable.FORM_DEMO_TITLE);
		model.addAttribute("geographyIndex", geographyIndexForm);
		return CommonVariable.PAGE_GEOGRAPHY_INDEX;
	}
	@RequestMapping(value = CommonVariable.PAGE_GEOGRAPHY_DETAILS_HTML, method = RequestMethod.GET)
	public String showForm(Map<String, GeographyDetailsForm> model,
			HttpServletRequest httpRequest) {
		GeographyDetailsForm geographyDetailsForm = new GeographyDetailsForm();
		model.put("geographyDetailsForm", geographyDetailsForm);
		return CommonVariable.PAGE_GEOGRAPHY_DETAILS;
	}
	@RequestMapping(value = "geographyDetailsBack")
	public String back() {
		return "redirect:"+CommonVariable.PAGE_GEOGRAPHY_INDEX_HTML;
	}
}
